## -*- mode: html; coding: utf-8; -*-

## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## CDS Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDS Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

<!-- WebDoc-Page-Title: BibConvert Admin Guide -->
<!-- WebDoc-Page-Navtrail: <a class="navtrail" href="<CFG_SITE_URL>/help/admin<lang:link/>">_(Admin Area)_</a> -->
<!-- WebDoc-Page-Revision: $Id$ -->

<h2>Contents</h2>
<strong>A. <a href="#A">Overview</a></strong><br />
<strong>B. <a href="#B">XML-oriented mode</a></strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>1 <a href="#B.1">Configuration File Examples</a></strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>2 <a href="#B.2">Running BibConvert</a></strong><br />
<strong>C. <a href="#C">Plain text-oriented mode</a></strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>1 <a href="#C.1">Configuration File Examples</a></strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>2 <a href="#C.2">Running BibConvert</a></strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>3 <a href="#C.3">BibConvert Configuration Guide</a></strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#G">Conventions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.1 <a href="#C.3.1">Step 1 Definition of Source Record</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.2 <a href="#C.3.2">Step 2 Definition of Source Fields</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.3 <a href="#C.3.3">Step 3 Definition of Target Record</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.4 <a href="#C.3.4">Formatting in BibConvert</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.4.1 <a href="#C.3.4.1">Definition of Formatting Functions</a><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.4.2 <a href="#C.3.4.2">Generated Values</a><br />

<a name="A"></a><h2>A. Overview</h2>

<p>BibConvert utility enables you to convert metadata records from
various metadata formats into another metadata format supported by the
CDS Invenio local database. It is designed to process XML harvested
metadata records, converting them into MARC21 before they are uploaded
into the database. However, BibConvert is flexible enough to deal also
with other structured metadata according to your needs, and offers a
way to actually insert what you want into the database.

<p>BibConvert is suitable for tasks such as conversion of records
received from multiple data sources, or conversion of records from
another system that may support a different metadata format.</p>


<p>In order to cover a wider range of possible conversions, BibConvert
has 2 different modes, each dealing with different types of data, and
each using different configuration files.<p>

<dl>
<dt><b>Plain text-oriented mode:</b></dt>
<dd>Deals with source data being typically structured with line breaks,
and character-based separators. You can use this mode when you need
to process line-based data, such as comma/tab separated values.
Still, this mode is powerful enough to convert
complex structures, at the cost of a more complex configuration.</dd>
<dt><b>XML-oriented mode</b></dt>
<dd>Convert source data being encoded in XML. Provided you have installed
a supported XSLT processor on your machine, BibConvert can make use of standard
XSLT to interpret your XML data.
</dd>
</dl>
<p>In addition to XSLT, we provide a home-made solution for converting
XML source data. It uses our own BFX language as transformation language,
extended with XPath for node selections.<br/>
You should consider using this solution only in the case where you have not installed (or do not
want to install) an XSLT processor on your machine.
</p>


<a name="B"></a><h2>B XML-Oriented Mode</h2>
<a name="B.1"></a><h3>1 Configuration File Examples</h3>
<h4>Using XSLT</h4>
You can use standard XSL stylesheets to transform your source data. Have a look
at the provided samples in <code>etc/bibconvert/config</code> directory
of your CDS Invenio installation.<br/>
<h4>Using BFX</h4>
BFX (BibFormat for XML) uses a syntax similar to XSLT. Roughly they only
differ in the name of the tags.<br/>
More documentation about it is to be added soon (FIXME).<br/>
Have a look
at the provided samples in <code>etc/bibconvert/config</code> directory
of your CDS Invenio installation to learn more about it.
<a name="B.2"></a><h3>2. Running BibConvert</h3>
BibConvert in XML-oriented mode has only 1 parameter: <code>-c</code>.
It is used to specify which transformation stylesheet to apply to the piped XML.
<blockquote>
<pre>
$ bibconvert -coaidc2marcxml.xsl < sample.xml > /tmp/record.xml
</pre>
</blockquote>

If the stylesheet you want to use is installed in the <code>etc/bibconvert/config</code>
directory of your CDS Invenio installation, then you can just refer to it by its filename.
Otherwise use the full path to the file.

<a name="C"></a><h2>C Plain Text-Oriented Mode</h2>
<a name="C.1"></a><h3>1 Configuration File Examples</h3>

<p>OAI DublinCore into MARC21 and OAI MARC into MARC21 configurations
will be provided as default configuration, ensuring the standard
uploading sequence
(incl. <a href="bibharvest-admin-guide">BibHarvest</a>
and <a href="bibupload-admin-guide">BibUpload</a> utilities). Other
configurations can be created according to your needs. The
configuration file that has to be created for each data source is a
text file with following structure:

<protect>
<blockquote>
<pre>
&nbsp; ### the configuration starts here
&nbsp; ### Configuration of bibconvert templates
&nbsp; ### source data : <source_data_name>
&nbsp;
&nbsp; === data extraction configuration template ===
&nbsp; ### here comes the data extraction configuration template
&nbsp; #   entry example:
&nbsp;
&nbsp; AU---%A---MAX---;---
&nbsp;
&nbsp; #   extracts maximum available data by field from metadata record
&nbsp; #   the values are found between specified tags
&nbsp; #   in this case between the '%A' tag and other tags defined
&nbsp; #   repetitive values are recognized by a semicolon separator
&nbsp; #   resp. by multiple presence of '%A' tag
&nbsp;
&nbsp; ===   data source configuration template   ===
&nbsp; ### here comes the data source configuration template
&nbsp; #   entry example:
&nbsp;
&nbsp; AU---<:FIRSTNAME:>-<:SURNAME:>
&nbsp;
&nbsp; #   describes the contents of extracted source data fields
&nbsp; #   in this case, the field AU is described as having two distinct subfields
&nbsp;
&nbsp; ===   data target configuration template   ===
&nbsp; ### here comes the data target configuration template
&nbsp; #   entry example:
&nbsp;
&nbsp; AU::CONF(AU,,0)---&lt;datafield id="700" ind1="" ind2="">&lt;subfield code="a">&lt;:AU*::SURNAME::CAP():>, &lt;AU*::FIRSTNAME::ABR():>&lt;/subfield>&lt;/datafield>
&nbsp;
&nbsp; #   This section concerns rather the desired output, while previous two were focused on the data source structures.
&nbsp; #   Each line equals to one output line, composed of given literals and values from extracted source data fields.
&nbsp; #   In this example, the XML Marc21 output line is defined,
&nbsp; #   containing re-formatted values of source fields SURNAME and FIRSTNAME
&nbsp;
&nbsp; ### the configuration ends here
</pre>
</blockquote>
</protect>

<p>Having prepared a configuration, the BibConvert will convert the
source data file according to it in a batch mode. The BibConvert is
fully compatible with the Uploader1.x configuration language. For more
information, have a look at the <a href="#C.3">BibConvert Configuration
Guide</a> section below.


<a name="C.2"></a><h3>2. Running BibConvert</h3>

<p>For a fully functional demo, consider the following sample input data:

<blockquote>
<a href="<CFG_SITE_URL>/admin/bibconvert/sample.dat">sample.dat</a> -- sample bibliographic data to be converted and inputted into CDS Invenio
<br /><a href="<CFG_SITE_URL>/admin/bibconvert/sample.cfg">sample.cfg</a> -- sample configuration file, featuring knowledge base demo
</blockquote>

<p>To convert the above data into XML MARC, use the following command:

<blockquote>
<pre>
$ bibconvert -b'&lt;collection>' -csample.cfg -e'&lt;/collection>' < sample.dat > /tmp/sample.xml
</pre>
</blockquote>

and see the XML MARC output file.  You would then continue the upload procedure by calling <a
href="bibupload-admin-guide">BibUpload</a>.

<p>Other useful BibConvert configuration examples:

<blockquote>
<a href="<CFG_SITE_URL>/admin/bibconvert/dcq.cfg">dcq.cfg</a> -- Qualified Dublin Core in SGML to XML MARC example
<br /><a href="<CFG_SITE_URL>/admin/bibconvert/dcq.dat">dcq.dat</a> -- corresponding data file, featuring collection identifiers demo
</blockquote>

<blockquote>
<a href="<CFG_SITE_URL>/admin/bibconvert/dcxml-to-marcxml.cfg">dcxml-to-marcxml.cfg</a> -- OAI XML Dublin Core to XML MARC example
</blockquote>

<blockquote>
<a href="<CFG_SITE_URL>/admin/bibconvert/bibtex.cfg">bibtex.cfg</a> -- BibTeX to XML MARC example
</blockquote>

<a name="C.3"></a><h3>3 BibConvert Configuration Guide</h3>

<h4><a name="G"></a>Conventions</h4>

<br/>- comment line starts with '#' sign in the first column
<br/>- each section is declared by a line starting with '===' (further characters on the line are ignored)
<br/>- values are separated by '---'

<h4><a name="C.3.1"></a>3.1 Step 1 Definition of Source record</h4>
<p>- Create/edit "data extraction configuration template" section of the configuration file.
<br />- Each line of this section stands for a definition of one source field:
<p><strong>name---keyword---terminating string---separator---</strong>
<p>- Choose a (valid) name allowed by the system
<br />- Enter <strong>keyword</strong> and <strong>terminating string</strong>, which are boundary tags for
the wanted value extraction
<br />- In case the field is repetitive, enter the value <strong>separator</strong>
<br />- "<strong>---</strong>"is mandatory separator between all values, even zero-length
<br />- <strong>MAX</strong>/<strong>MIN</strong> keywords can be used instead of terminating string
<br />&nbsp;
<p>Example of a definition of author(repetitive) and title (non-repetitive)
fields:
<br />
<pre>
&nbsp; === data extraction configuration template ===
&nbsp; ### here comes the data extraction configuration template
&nbsp;
&nbsp; AU---AU_---MAX---;---
&nbsp; TI---TI_---EOL------
</pre>

<h4><a name="C.3.2"></a>3.2 Step 2 Definition of Source fields</h4>
<I>Each field extracted from the source according to the definition done
in the first step can have an internal structure, which is described in
this section.</I>
<p>- Create/edit "data source configuration template" section of the configuration file.
<br />- Each line of this section stands for a definition of one source field
<br />- <name> corresponds to the name defined in the step 1
<p>name---{CONST&lt;:SUBFIELD:>[CONST]}}
<p>- Enter only constants that appear systematically.
<br />- Between two discrete subfields has to be defined a constant of a non zero
length
<br />- "---"is a mandatory separator between the name and the source
field definition
<p>Example of a definition of author(repetitive) and title (non-repetitive)
fields:
<pre>
===   data source configuration template   ===
TI---&lt;:TI:>
AU---&lt;:FIRSTNAME:>-&lt;:SURNAME:>
</pre>

<h4><a name="C.3.3"></a>3.3 Step 3 Definition of target record</h4>
<I>This definition describes the layout of the target record that is created by the conversion,
together with the corresponcence to the source fields defined in step 2.</I>

<p>- Create/edit "data target configuration template" section of the configuration file.
<br />- Each line of this section stands for an output line created by the conversion.
<br />- &lt;name> corresponds to the name defined in the steps 1 and 2
<p>CODE---CONST&lt;:name::SUBFIELD::FUNCT():>CONST&lt;:GENERATED_VALUE:>
<p>- <strong>CODE</strong> stands for a tag for readability (optional)
<br />- "<strong>::</strong>"is a mandatory separator between the name and the subfield
definition
<br />- optionally, you can apply the appropriate <a href="#C.3.4.1">formatting function(s)</a>
and <a href="#C.3.4.2">generated values</a>
<br />- "<strong>::</strong>"is a mandatory separator between the subfield definition and the function(s)
<br />- "<strong>---</strong>"is a mandatory separator between the tag and the output code definition
<br />- mark repetitive source fields with an asterisk (*)
<p>Example of a definition of author (repetitive) and title (non-repetitive) codes:

<protect>
<pre>
<br/>AU::CONF(AU,,0)---&lt;datafield id="700" ind1="" ind2="">&lt;subfield code="a">&lt;:AU*::AU:>&lt;/subfield>&lt;/datafield>
<br/>TI::CONF(TI,,0)---&lt;datafield id="245" ind1="" ind2="">&lt;subfield code="a">&lt;:TI::TI::SUP(SPACE, ):>&lt;/subfield>&lt;/datafield>
</pre>
</protect>

<br />- preserve newlines in a source field for later use by formatting
functions by marking them with "^"
<p>Example of a definition of a book editors field in which the newlines are preserved
so that they can be processed by the JOINMULTILINES formatting function:
<protect>
<pre>
<br/>AU---&lt;datafield id="773" ind1=" " ind2=" ">&lt;:BOOKEDITOR^::BOOKEDITOR::JOINMULTILINES(&lt;subfield code="a">,&lt;/subfield>):>&lt;/datafield>
<br /><br />
With a value such as:<br />
Test
Case, A
<br />
The results may be:<br /><br />
&lt;datafield tag="773" ind1="" ind2="">&lt;subfield code="a">Test&lt;/subfield>&lt;subfield code="a">Case, A&lt;/subfield>&lt;/datafield>
</pre>
</protect>


<h4><a name="C.3.4"></a>3.4 Formatting in BibConvert</h4>

<h5>&nbsp;<a name="C.3.4.1"></a>3.4.1 Definition of formatting functions</h5>

<blockquote>Every field can be processed with a variety of functions that
partially or entirely change the original value.
<br />There are three types of functions available that take as element either
single characters, words or the entire value of processed field.
<br />&nbsp;
<p>Every function requires a certain number of parameters to be entered
in brackets. If an&nbsp; insufficient number of parameters is present,
the function uses default values. Default values are constructed with attempt to keep the original value.
<p>The configuration of templates is case sensitive.
<p>The following functions are available:
<p><a href="#ADD">ADD(prefix,suffix) - add prefix/suffix</a>
<br /><a href="#KB">KB(kb_file,[0-9]) -lookup in kb_file and replace value</a>
<br /><a href="#ABR">ABR(x,suffix)/ABRW(x,suffix) - abbreviation with suffix addition</a>
<br /><a href="#ABRX">ABRX() - abbreviate exclusively words longer</a>
<br /><a href="#CUT">CUT(prefix,postfix) - remove substring from side</a>
<br /><a href="#REP">REP(x,y) - replacement of characters</a>
<br /><a href="#SUP">SUP(type) - suppression of characters of specified type</a>
<br /><a href="#LIM">LIM(n,L/R)/LIMW(str,L/R) - restriction to n letters</a>
<br /><a href="#WORDS">WORDS(n,side) - restriction to n words from L/R</a>
<br /><a href="#MINL">MINL(n)/MAXL(n) - replacement of words shorter/greater
than n</a>
<br /><a href="#MINLW">MINLW(n) - replacement of short values</a>
<br /><a href="#EXPW">EXP(str,1|0)/EXPW(type) - replacement of words from
value if containing spec. type/string</a>
<br /><a href="#IF">IF(value,valueT,valueF) - replace T/F value</a>
<br /><a href="#UP">UP/DOWN/CAP/SHAPE/NUM - lower case and upper case, shape</a>
<br /><a href="#SPLIT">SPLIT(n,h,str,from)/SPLITW(sep,h,str,from) - split
into more lines</a>
<br /><a href="#CONF">CONF(field,value,1/0)/CONFL(value,1/0) - confirm validity
of a field</a>
<br /><a href="#RANGE">RANGE(from,to) - confirm only entries in the specified
range</a>
<br /><a href="#DEFP">DEFP() - default print</a>
<br /><a href="#IFDEFP">IFDEFP(field,value,1/0) - IF condition is met, default print</a>
<br /><a href="#JOINMULTILINES">JOINMULTILINES(prefix,suffix) - Join a multiline string into a single line
with each segment having prefix and suffix</a>
<br />&nbsp;</blockquote>

<h4>
<a name="ADD"></a>ADD(prefix,postfix)</h4>

<blockquote>default: ADD(,)&nbsp;&nbsp;&nbsp; no addition
<p>Adds prefix/postfix to the value, we can use this function to add the proper
field name as a prefix of the value itself:
<p>ADD(WAU=,)&nbsp;&nbsp;&nbsp; prefix for the first author (which may
have been taken from the field AU2)
<br />&nbsp;</blockquote>

<h4>
<a name="KB"></a>KB(kb_file)&nbsp;&nbsp;&nbsp; -&nbsp;&nbsp;&nbsp; kb_file search</h4>

<blockquote>default: KB(kb_file,1/0/R)
<p>The input value is compared to a kb_file and may be replaced
by another value. In the case that the input value is not recognized, it is by default kept
without any modification. This default can be overridden by <strong>_DEFAULT_---default value</strong> entry in the kb_file
<p>The file specified in the parameter is a text file representing a table
of values that correspond to each other:
<p>{<strong>input_value---output_value</strong>}
<p>KB(file,1) searches the exact value passed.
<br />KB(file,0) searches the KB code inside the value passed.
<br />KB(file,2) as 0 but not case sensitive
<br />KB(file,R) replacements are applied on substrings/characters only.
<br/>
<br/>    bibconvert look-up value in KB_file in one of following modes:
<br/>    ===========================================================
<br/>    1                           - case sensitive     / match  (default)
<br/>    2                           - not case sensitive / search
<br/>    3                           - case sensitive     / search
<br/>    4                           - not case sensitive / match
<br/>    5                           - case sensitive     / search (in KB)
<br/>    6                           - not case sensitive / search (in KB)
<br/>    7                           - case sensitive     / search (reciprocal)
<br/>    8                           - not case sensitive / search (reciprocal)
<br/>    9                           - replace by _DEFAULT_ only
<br/>    R                           - not case sensitive / search (reciprocal)  replace
<br/>
<br/>
<p>Edge spaces are not considered.
Output value is not further formated.</blockquote>

<h4>
<a name="ABR"></a>ABR(x,trm),ABRW(x,trm)&nbsp; - abbreviate term to x places
with(out) postfix</h4>

<blockquote>default: ABR(1,.)
<br />default: ABRW(1,.)
<p>The words in the input value are shortened according to the parameters
specified. By default, only the initial character is kept and the output
value is terminated by a dot.
<br />ABRW takes entire value as one word.
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>ABR()</td>

<td>firstname_surname</td>

<td>f._s.</td>
</tr>

<tr>
<td>ABR(1,)</td>

<td>firstname_surname</td>

<td>f_s</td>
</tr>

<tr>
<td>ABR(10,COMMA)</td>

<td>firstname_surname</td>

<td>firstname,_surname,</td>
</tr>
</table>
</blockquote>
</blockquote>


<h4>
<a name="ABRX"></a>ABRX() - abbreviate exclusively words longer than given limit</h4>
<blockquote>default: ABRX(1,.)
<p>Exclusively words that reach the specified length limit in the input value are abbreviated.
No suffix is appended to the words shorter than specified limit.
</blockquote>

<h4>
<a name="CUT"></a>CUT(prefix,postfix) - remove substring from side</h4>

<blockquote>default: CUT(,)
<p>Remove string from the value (reverse function to the "ADD")

</blockquote>

<h4>
<a name="REP"></a>REP(x,y)&nbsp;&nbsp; - replace x with y</h4>

<blockquote>default: REP(,)&nbsp;&nbsp;&nbsp; no replacement
<p>The input value is searched for the string specified in the first parameter.
All such strings are replaced with the string specified in the second parameter.

</blockquote>

<h4>
<a name="SUP"></a>SUP(type,string)&nbsp;&nbsp; - suppress chars of certain
type</h4>

<blockquote>default: SUP(,)&nbsp;&nbsp;&nbsp; type not recognized
<p>All groups of characters belonging to the type specified in the first
parameter are suppressed or replaced with a string specified in the second
parameter.
<p>Recognized types:
<p>SPACE .. invisible chars incl. NEWLINE
<br />ALPHA .. alphabetic
<br />NALPHA .. not alphabetic
<br />NUM .. numeric
<br />NNUM&nbsp;&nbsp;&nbsp; .. not numeric
<br />ALNUM&nbsp; .. alphanumeric
<br />NALNUM&nbsp; .. non alphanumeric
<br />LOWER&nbsp; .. lower case
<br />UPPER&nbsp; .. upper case
<br />PUNCT&nbsp; .. punctuation
<br />NPUNCT&nbsp; .. not punctuation
<br />&nbsp;
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>SUP(SPACE,-)</td>

<td>sep_1999</td>

<td>sep-1999</td>
</tr>

<tr>
<td>SUP(NNUM)</td>

<td>sep_1999</td>

<td>1999</td>
</tr>

<tr>
<td>SUP(NUM)</td>

<td>sep_1999</td>

<td>sep_</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
<a name="LIM"></a>LIM(n,side)/LIMW(str,side)&nbsp;&nbsp; - limit to n letters while trimming
L/R side</h4>

<blockquote>default: LIM(0,)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
no change
<br />default: LIMW(,R)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; no change
<p>Limits the value to the required number of characters by
cutting excess characters either on the Left or Right.
<br />LIMW locates the first occurrence of (str) string and cut either Left or Right side.
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>LIM(4,L)</td>

<td>sep_1999</td>

<td>1999</td>
</tr>

<tr>
<td>LIM(4,R)</td>

<td>sep_1999</td>

<td>sep_</td>
</tr>

<tr>
<td>LIMW(_,R)</td>

<td>sep_1999</td>

<td>sep_</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
<a name="WORDS"></a>WORDS(n,side)&nbsp; - limit to n words while trimming L/R side</h4>

<blockquote>default: WORDS(0,R)
<p>Keeps the number of words specified in the first parameter and cuts the excessive
characters either on Left or Right.
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>WORDS(1,R)</td>

<td>Sep 1999</td>

<td>Sep</td>
</tr>

<tr>
<td>WORDS(1,L)</td>

<td>Sep 1999</td>

<td>1999</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
<a name="MINL"></a>MINL(n)&nbsp;&nbsp; - exp. words shorter than n</h4>

<blockquote>default: MINL(1)
<p>All words shorter than the limit specified in the parameter are replaced
from the sentence.
<br />The words with length exactly n are kept.
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>MINL(2)</td>

<td>History of Physics</td>

<td>History of Physics</td>
</tr>

<tr>
<td>MINL(3)</td>

<td>History of Physics</td>

<td>History Physics</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
MAXL(n)&nbsp;&nbsp; - exp. words longer than n</h4>

<blockquote>default: MAXL(0)
<p>All words greater in number of characters than the limit specified in
the parameter are replaced. Words with length exactly n are kept.
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>MAXL(2)</td>

<td>History of Physics</td>

<td>of</td>
</tr>

<tr>
<td>MAXL(3)</td>

<td>History of Physics</td>

<td>of</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
<a name="MINLW"></a>MINLW(n) - replacement of short values</h4>

<blockquote>default: MINLW(1) (no change)
<p>The entire value is deleted if shorter than the specified limit.
<br />This is used for the validation of created records, where we have 20
characters in the header.
<br />The default validation is MINLW(21), i.e. the record entry will not
be consided as valid, unless it contains at least 21 characters including
the header. This default setting can be overriden by the -l command line option.
<p>In order to increase the necessary length of the output line in the configuration
itself, apply the function on the total value:
<p>AU::MINLW(25)---CER &lt;:SYSNO:> AU&nbsp;&nbsp;&nbsp; L &lt;:SURNAME:>,
&lt;:NAME:>
<br />&nbsp;
<br />&nbsp;</blockquote>

<h4>
<a name="EXPW"></a>EXP(str,1|0) - exp./aprove word containing specified
string</h4>

<blockquote>default: EXP&nbsp;&nbsp; (,0)&nbsp;&nbsp;&nbsp;&nbsp; leave
all value
<p>The record is shortened by replacing words containing the specified
string.
<br />The second parameter states whether the string approves the word (0)
or disables it (1).
<p>for example, to get the email address from the value, use the following
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>EXP(@,0)</td>

<td>mail to: libdesk@cern.ch</td>

<td>libdesk@cern.ch</td>
</tr>

<tr>
<td>EXP(:,1)</td>

<td>mail to: libdesk@cern.ch</td>

<td>mail libdesk@cern.ch</td>
</tr>

<tr>
<td>EXP(@)</td>

<td>mail to: libdesk@cern.ch</td>

<td>libdesk@cern.ch</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
EXPW(type)&nbsp;&nbsp; - exp. word from value if containing spec. type</h4>

<blockquote>default: EXPW&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type
not recognized
<br />&nbsp;
<p>The sentence is shortened by replacing words containing specified type
of character.
<p>Types supported in EXPW function:
<p>ALPHA .. alphabetic
<br />NALPHA .. not alphabetic
<br />NUM .. numeric
<br />NNUM&nbsp;&nbsp;&nbsp; .. not numeric
<br />ALNUM&nbsp; .. alphanumeric
<br />NALNUM&nbsp; .. non alphanumeric
<br />LOWER&nbsp; .. lower case
<br />UPPER&nbsp; .. upper case
<br />PUNCT&nbsp; .. punctuation
<br />NPUNCT&nbsp; .. non punctuation
<p>Note: SPACE is not handled as a keyword, since all space characters
are considered as word separators.
<blockquote>&nbsp;
<table border  width="50%"  >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>EXPW(NNUM)</td>

<td>sep_1999</td>

<td>1999</td>
</tr>

<tr>
<td>EXPW(NUM)</td>

<td>sep_1999</td>

<td>sep</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
<a name="IF"></a>IF(value,valueT,valueF) - replace T/F value</h4>

<blockquote>default: IF(,,)
<p>Compares the value with the first parameter. In case the result is TRUE,
the input value is replaced with the second parameter, otherwise the input
value is replaced with the third parameter.
<br />In case the input value has to be kept, whatever it is, the keyword
ORIG can be used (usually in the place of the third parameter)
<blockquote>&nbsp;
<table border width="50%" >
<tr>
<td>example</td>

<td>input</td>

<td>output</td>
</tr>

<tr>
<td>IF(sep_1999,sep)</td>

<td>sep_1999</td>

<td>sep</td>
</tr>

<tr>
<td>IF(oct_1999,oct)</td>

<td>sep_1999</td>

<td></td>
</tr>

<tr>
<td>IF(oct_1999,oct,ORIG)</td>

<td>sep_1999</td>

<td>oct_1999</td>
</tr>
</table>
</blockquote>
</blockquote>

<h4>
<a name="UP"></a>UP&nbsp;&nbsp;&nbsp; - upper case</h4>

<blockquote>Convert all characters to upper case</blockquote>

<h4>
DOWN&nbsp;&nbsp; - lower case</h4>

<blockquote>Convert all characters to lower case</blockquote>

<h4>
CAP&nbsp;&nbsp;&nbsp; - make capitals</h4>

<blockquote>Convert the initial character of each word to upper case
and the rest of characters to lower case</blockquote>

<h4>
SHAPE&nbsp;&nbsp;&nbsp; - format string</h4>

<blockquote>Supresses all invalid spaces</blockquote>

<h4>
<B>NUM&nbsp;&nbsp;&nbsp; - number</B></h4>

<blockquote>If it contains at least one digit, convert it into a
number by suppressing other characters. Leading zeroes are deleted.</blockquote>

<h4>
<a name="SPLIT"></a>SPLIT(n,h,str,from)</h4>

<blockquote>Splits the input value into more lines, where each line contains
at most (n+h+length of str) characters, (n) being the number of characters
following the number of characters in the header, specified in (h). The
header repeats at the beginning of each line. An additional string can
be inserted as a separator between the header and the following value.
This string is specified by the third parameter (str). It is possible to
restrict the application of (str) so it does not appear on the first line
by entering "2" for (from)</blockquote>

<h4>
SPLITW(sep,h,str,from)</h4>

<blockquote>Splits the input value into more lines by replacing the line
separator stated in (sep) with CR/LFs. Also, as in the case of the SPLIT
function, the first (h) characters are taken as a header and repeat at
the beginning of each line.&nbsp; An additional string can be inserted
as a separator between the header and the following value. This string
is specified by the third parameter (str). It is possible to restrict the
application of (str) so it does not appear on the first line by entering
"2" for (from)</blockquote>

<h4>
<a name="CONF"></a>CONF(field,value,1/0)&nbsp; - confirm validity of a
field</h4>

<blockquote>The input value is taken as it is, or refused depending on
the value of some other field. In case the other (field) contains&nbsp;
the string specified in (value), then the input value is confirmed (1)
or refused (0).</blockquote>

<h4>
CONFL(str,1|0) - confirm validity of a field</h4>

<blockquote>The input value is confirmed if it contains (<B>1</B>)/misses(<B>0</B>)
the specified string (<B>str</B>)</blockquote>

<h4>
<a name="RANGE"></a>RANGE(from,to) - confirm only entries in the specified
range</h4>

<blockquote>Left side function of target template configuration section to select the desired
entries from the repetitive field.
<br />The range can only be continuous.
<p>The entry is confirmed in case its input falls into the range from-to
specified in the parameter, border values included. As an upper limit it
is possibe to use the keyword MAX.
<p>This is useful in case of AU code, where the first entry has a different
definition from other entries:
<p>AU::RANGE(1,1)---CER &lt;:SYSNO:> AU2&nbsp;&nbsp;&nbsp; L &lt;:AU::SURNAME:>,
&lt;:AU::NAME:>&nbsp;&nbsp;&nbsp; ... takes the first name from the defined
AU field
<br />AU::RANGE(2,MAX)---CER &lt;:SYSNO:> AU&nbsp;&nbsp;&nbsp;&nbsp; L &lt;:AU::SURNAME:>
, &lt;:AU::NAME:>&nbsp;&nbsp;&nbsp; ... takes the the rest of namesfrom
the AU field
<br />&nbsp;</blockquote>

<h4><a name="DEFP"></a>DEFP() - default print</h4>
<blockquote>The value is printed by default even if it does not contain any variable input from the source file.</blockquote>

<h4>
<a name="IFDEFP"></a>IFDEFP(field,value,1/0)&nbsp;- IF condition is met, default print</h4>
<blockquote>The line is printed by default (even if it does not contain any variable input from the source file) IF
a condition is met that depends on the value of some other field. The condition is basically either that "field"
contains "value" (in which case the 3rd parameter should be set to 1), or that "field" does NOT contain "value"
(in which case the 3rd parameter should be set to 0).
<br />
<br />
For example, given the following line:<br /><br />
690C::REP(EOL,)::IFDEFP(comboYEL,BOOK,1)---&lt;datafield tag="690" ind1="C" ind2=" ">&lt;subfield code="a">BOOK&lt;/subfield>&lt;/datafield><br />
<br />
We want to print the line if the (field) "comboYEL" contains the (value) "BOOK", otherwise we don't want to print it.
Therefore, the 3rd parameter is set to "1". However, in the following line:<br /><br />
690C::REP(EOL,)::IFDEFP(comboYEL,BOOK,0)---&lt;datafield tag="690" ind1="C" ind2=" ">&lt;subfield code="a">OTHER&lt;/subfield>&lt;/datafield><br />
<br />
We want to print the line if the (field) "comboYEL" does NOT contain the (value) "BOOK", otherwise we don't want to
print it. Therefore, the 3rd parameter is set to "0".<br />
<br />
This is achieved by using "IFDEFP". If the line had contained variables, the "CONF" function would have been used
instead.
</blockquote>

<h4>
<a name="JOINMULTILINES"></a>JOINMULTILINES(prefix,suffix) - Join a multiline string into a single line
with each segment having prefix and suffix</h4>
<blockquote>
Given a field-value with newlines in it, split the field on the new lines (\n),
separating them with prefix, then suffix. E.g.:<br />
For the field XX with the value:<br /><br />
&nbsp;&nbsp;Test<br />
&nbsp;&nbsp;Case, A<br />
<br />And the function call:<br /><br />
&nbsp;&nbsp;&lt;:XX^::XX::JOINMULTILINES(&lt;subfield code="a">,&lt;/subfield>):><br />
<br />The results would be:<br />
<br />&nbsp;&nbsp;&lt;subfield code="a">Test&lt;/subfield>&lt;subfield code="a">Case, A&lt;/subfield><br />
<br />One note on this: &lt;:XX^::XX:<br />
Without the ^ the newlines will be lost as bibconvert will remove them, so
you'll never see an effect from this function.
</blockquote>

<h4>
<a name="C.3.4.2"></a>3.4.2 Generated values</h4>

<blockquote>In the template configurations, values can be either taken from the source
or generated in the process itself. This is mainly useful for evaluating constant values.

<p>Currently, the following date values are generated:
<br />&nbsp;</blockquote>

<h4>
DATE(format,n)</h4>

<blockquote>default: DATE(,10)
<p>where n is the number of digits required.
<p>Generates the current date in the form given as a parameter. The format
has to be given according to the ANSI C notation, i.e. the string is composed
out of following components:
<p><a name="date"></a>&nbsp; %a&nbsp;&nbsp;&nbsp; abbreviated weekday name
<br />&nbsp; %A&nbsp;&nbsp;&nbsp; full weekday name
<br />&nbsp; %b&nbsp;&nbsp;&nbsp; abbreviated month name
<br />&nbsp; %B&nbsp;&nbsp;&nbsp; full month name
<br />&nbsp; %c&nbsp;&nbsp;&nbsp; date and time representation
<br />&nbsp; %d&nbsp;&nbsp;&nbsp; decimal day of month number (01-31)
<br />&nbsp; %H&nbsp;&nbsp;&nbsp; hour (00-23)(12 hour format)
<br />&nbsp; %I&nbsp;&nbsp;&nbsp; hour (01-12)(12 hour format)
<br />&nbsp; %j&nbsp;&nbsp;&nbsp; day of year(001-366)
<br />&nbsp; %m&nbsp;&nbsp;&nbsp; month (01-12)
<br />&nbsp; %M&nbsp;&nbsp;&nbsp; minute (00-59)
<br />&nbsp; %p&nbsp;&nbsp;&nbsp; local equivalent of a.m. or p.m.
<br />&nbsp; %S&nbsp;&nbsp;&nbsp; second (00-59)
<br />&nbsp; %U&nbsp;&nbsp;&nbsp; week number in year (00-53)(starting with
Sunday)
<br />&nbsp; %V&nbsp;&nbsp;&nbsp; week number in year
<br />&nbsp; %w&nbsp;&nbsp;&nbsp; weekday (0-6)(starting with Sunday)
<br />&nbsp; %W&nbsp;&nbsp;&nbsp; week number in year (00-53)(starting with
Monday)
<br />&nbsp; %x&nbsp;&nbsp;&nbsp; local date representation
<br />&nbsp; %X&nbsp;&nbsp;&nbsp; local time representation
<br />&nbsp; %y&nbsp;&nbsp;&nbsp; year (no century prefix)
<br />&nbsp; %Y&nbsp;&nbsp;&nbsp; year (with century prefix)
<br />&nbsp; %Z&nbsp;&nbsp;&nbsp; time zone name
<br />&nbsp; %%&nbsp;&nbsp;&nbsp; %
<br />&nbsp;</blockquote>

<h4>
WEEK(diff)</h4>

<blockquote>Enters the two-digit number of the current week (%V) increased
by specified difference.
<br />If the resulting number is negative, the returned value is zero (00).
<br />Values are kept up to 99, three digit values are shortened from the
left.
<p>WEEK(-4)&nbsp;&nbsp;&nbsp; returns 48, if current week is 52
<br />WEEK&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; current
week
<br />&nbsp;</blockquote>

<h4>
SYSNO</h4>

<blockquote>&nbsp;
<br />Works the same as DATE, however the format of the resulting value is
fixed so it complies with the requirements of further record handling.
The format is 'whhmmss', where:
<p>w&nbsp;&nbsp;&nbsp;&nbsp; current weekday
<br />hh&nbsp;&nbsp;&nbsp; current hour
<br />mm&nbsp;&nbsp;&nbsp; current minute
<br />ss&nbsp;&nbsp;&nbsp; current second
<p>The system number, if generated like this, contains a variable value
changing every second. For the system number is an identifier of the record,
it is needed to ensure it will be unique for the entire record processed.
Unlike the function DATE, which simply generates the value of format given,
SYSNO keeps the value persistent throughout the entire record and excludes collision
with other records that are generated in period of one week with one second granularity.
<p>It is not possible to use the DATE function for generating a system number instead.
<p>The system number is unique in range of one week only, according to
the current definition.
<br />&nbsp;

<br />&nbsp;</blockquote><h4>
OAI</h4>

<blockquote>

<p/>Inserts  OAI identifier incremented by one for earch record
Starting value that is used in the first record in the batch job can be specified on the command line using the -o&lt;starting_value> option.
</blockquote>
